<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, user-scalable=yes, initial-scale=0.3, maxmum-scale=1.0, minimum-scale=0.3"
    />
    <title>Document</title>
    <style>
      ul {
        padding: 0;
        margin: 0;
      }
      a {
        list-style: none;
        text-decoration: none;
        color: #999999;
      }
      li {
        list-style: none;
      }
      header h1 {
        text-align: center;
      }
      .search {
        height: 40px;
        width: 600px;
      }
      .search-city {
        height: 31px;
        width: 500px;
        float: left;
        outline: none;
        border-left: 1px solid #cccccc;
      }
      .button {
        display: block;
        height: 35px;
        width: 90px;
        padding: 0;
        border: 1px solid #cccccc;
        line-height: 35px;
        text-align: center;
        float: left;
        cursor: pointer;
      }
      .city a {
        margin-left: 10px;
      }
      #app {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
      }
      .item {
        width: 200px;
        height: 200px;
        border-right: 1px solid #cccccc;
        float: left;
      }
      .item h3 {
        text-align: center;
        color: orange;
        padding-top: 30px;
      }
      .pro {
        display: block;
        text-align: center;
        color: orange;
      }
      .date {
        display: block;
        text-align: center;
        margin-top: 30px;
      }
      .items {
        margin-top: 50px;
        width: 1005px;
      }
      .content {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
      }
      .clearfix:after {
        content: "";
        display: block;
        visibility: hidden;
        clear: both;
      }
      .show {
        margin-top: 130px;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <!-- 标题 -->
      <header>
        <h1>天知道</h1>
      </header>
      <div class="content">
        <div class="search clearfix">
          <input
            type="text"
            v-model="city"
            @keyup.enter="showWeather"
            class="search-city"
            placeholder="请输入想要查询的城市"
          />
          <span class="button" @click="search">搜索</span>
        </div>
        <span class="city"
          ><a href="#" @click="cityBtn('北京')">北京</a
          ><a href="#" @click="cityBtn('上海')">上海</a
          ><a href="#" @click="cityBtn('广州')">广州</a
          ><a href="#" @click="cityBtn('深圳')">深圳</a></span
        >
      </div>
      <div class="show clearfix">
        <ul class="items clearfix">
          <li class="item" v-for="(item,index) in weatherList">
            <h3>{{item.type}}</h3>
            <span class="pro">{{item.low}}-{{item.high}}</span>
            <span class="date">{{item.date}}</span>
          </li>
        </ul>
      </div>
    </div>
    <script src="js/vue.js"></script>
    <script src="js/axios.js"></script>
    <script src="js/index.js"></script>
  </body>
</html>
